<template>
  <div class="detail-info"  v-if="Object.keys(detailBaseInfo).length !==0">
    <div class="title">
      <h3>{{ detailBaseInfo.title }}</h3>
    </div>

    <div class="price">
      <span class="newprice">{{ detailBaseInfo.newPrice }}</span>
      <span class="oldprice">{{ detailBaseInfo.oidPrice }}</span>
      <span :class="{ discount: detailBaseInfo.discount }">
        {{ detailBaseInfo.discount }}
      </span>
    </div>

    <div class="info">
      <span>{{ detailBaseInfo.columns[0] }}</span>
      <span>{{ detailBaseInfo.columns[1] }}</span>
      <span>{{
        detailBaseInfo.services[detailBaseInfo.services.length - 1].name
      }}</span>
    </div>

    <div class="services">
      <span
        v-for="(item, index) in detailBaseInfo.services.length - 1"
        :key="index"
      >
        <img :src="detailBaseInfo.services[item].icon" alt="" />
        {{ detailBaseInfo.services[item - 1].name }}
      </span>
    </div>
  </div>
</template>

<script>
export default {
  name: "DetailBaseInfos",
  props: {
    detailBaseInfo: {
      type: Object,
      default() {
        return {};
      },
    },
  },
};
</script>

<style scoped>
.detail-info {
  margin: 5px;
}

.title {
  font-size: 15px;
  font-weight: 400;
  margin: 20px 0;
}

.price {
  position: relative;
}

.newprice {
  font-size: 20px;
  font-weight: 600;
  color: var(--color-tint);
}

.oldprice {
  font-size: 14px;
  text-decoration: line-through;
  padding: 0 10px;
}

.discount {
  position: absolute;
  bottom: 5px;
  font-size: 15px;
  color: #fff;
  padding: 3px;
  background: var(--color-tint);
  border-radius: 15px;
}

.info {
  display: flex;
  justify-content: space-between;
  margin-top: 30px;
  padding-bottom: 20px;
  border-bottom: 1px solid rgba(100, 100, 100, 0.5);
}

.services {
  display: flex;
  justify-content: space-between;
  height: 60px;
  line-height: 60px;
  font-size: 15px;
  border-bottom: 5px solid #eee;
}

.services img {
  width: 15px;
  vertical-align: middle;
}
</style>
